
public class Laser {
	public static int BEAM = Truck.LIGHTSTONE;
	public static int AIR = 0;
	private CardinalDirection direction;
	private SimpleLocation location;
	
	public Laser(SimpleLocation l, CardinalDirection d) {
		direction = d;
		location = l;
		location.setBlock(BEAM);
	}
	
	public synchronized void doWork() {
		location.setBlock(AIR);
		location.moveMe(direction);
		if(location.getBlockID() == AIR) {
			location.setBlock(BEAM);
		} else {
			explode();
		}
	}
	
	private void explode() {
		location.setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,2).setBlock(AIR);
		location.move(CardinalDirection.NORTH,3).setBlock(AIR);
		location.move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,2).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,3).setBlock(AIR);
		location.move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,3).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,3).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,3).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,3).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,3).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,3).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,3).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,3).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,3).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,3).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,3).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,3).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,3).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,1).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,3).setBlock(AIR);
		
		location.move(CardinalDirection.DOWN,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.DOWN,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.NORTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.EAST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,1).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,1).move(CardinalDirection.WEST,2).setBlock(AIR);
		location.move(CardinalDirection.UP,2).move(CardinalDirection.SOUTH,2).move(CardinalDirection.WEST,2).setBlock(AIR);

		location.move(CardinalDirection.DOWN,3).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.NORTH).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.EAST).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.SOUTH).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.WEST).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.NORTH).move(CardinalDirection.EAST).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.NORTH).move(CardinalDirection.WEST).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.SOUTH).move(CardinalDirection.EAST).setBlock(AIR);
		location.move(CardinalDirection.DOWN,3).move(CardinalDirection.SOUTH).move(CardinalDirection.WEST).setBlock(AIR);
		location.move(CardinalDirection.UP,3).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.NORTH).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.EAST).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.SOUTH).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.WEST).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.NORTH).move(CardinalDirection.EAST).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.NORTH).move(CardinalDirection.WEST).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.SOUTH).move(CardinalDirection.EAST).setBlock(AIR);
		location.move(CardinalDirection.UP,3).move(CardinalDirection.SOUTH).move(CardinalDirection.WEST).setBlock(AIR);
	}
}
